package com.feiyisuo.sso.config;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.oauth2.core.user.OAuth2User;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;


@Data
@EqualsAndHashCode(callSuper = false)
public class SsoOAuth2User implements OAuth2User, Serializable {
    private String sub;
    /**
     * email
     */
    @JsonProperty("email_verified")
    private boolean emailVerified;

    /**
     * 用户名称
     */
    private String name;

    private String nickname;

    /**
     * 分组
     */
    private List<String> groups;

    /**
     * 登录用户名
     */
    @JsonProperty("preferred_username")
    private String preferredUsername;

    @JsonProperty("given_name")
    private String givenName;

    @JsonProperty("family_name")
    private String familyName;

    private String email;




    @Override
    public Map<String, Object> getAttributes() {
        return null;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getName() {
        return preferredUsername;
    }
}
